
using FriendStar.Code;
using FriendStar.Domain.Entity.VBaseData;
using FriendStar.Domain.IRepository.VBaseData;
using FriendStar.Repository.VBaseData;
using System.Collections.Generic;
using System.Linq;
using SqlSugarRepository;
using System.Text;
using System.Data.SqlClient;
using System.Data;

namespace FriendStar.Application.VBaseData
{
    public class V_CPK_ZD_11_DatStoreHouseApp
    {
        private IV_CPK_ZD_11_DatStoreHouseRepository service = new V_CPK_ZD_11_DatStoreHouseRepository();
        private string userUnit = Configs.GetValue("UseUnit");
        string userCode = OperatorProvider.Provider.GetCurrent() == null ? "" : OperatorProvider.Provider.GetCurrent().UserCode;
        string userName = OperatorProvider.Provider.GetCurrent() == null ? "" : OperatorProvider.Provider.GetCurrent().UserName;
        public List<V_CPK_ZD_11_DatStoreHouseEntity> GetList(string FStoreNO, string FStoreName, string FResPerson)
        {
            var expression = ExtLinq.True<V_CPK_ZD_11_DatStoreHouseEntity>();
            if (!string.IsNullOrEmpty(userUnit))
            {
                expression = expression.And(t => t.UseUnit == userUnit);
            }
            if (!string.IsNullOrEmpty(FStoreNO))
            {
                expression = expression.And(t => t.FStoreNO.Contains(FStoreNO));
            }
            if (!string.IsNullOrEmpty(FStoreName))
            {
                expression = expression.And(t => t.FStoreName.Contains(FStoreName));
            }
            if (!string.IsNullOrEmpty(FResPerson))
            {
                expression = expression.And(t => t.FResPerson.Contains(FResPerson));
            }
            return service.IQueryable(expression).OrderBy(t => t.FStoreNO).ToList();
        }
    }
}
